import { site  } from '@/api/site'
// 引入vuex持久化方法createPersistedState


const state = {
  site: {},
}

const getters = {}

const mutations = {
  SET_SITE: (state, site) => {
    state.site = site;
  }
}

const actions = {
  // 获取网站配置
  async getSite({ commit }) {
    try {
      let result = await site()
      commit('SET_SITE', result.data)
      return result;
    } catch (error) {
      return Promise.reject(new Error('faile'))
    }
  } 
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
}
